{% load i18n %}

{% url 'admin:index' as HOME_PATH %}

<!-- Sidebar Menu -->
<nav class="mt-2">

  <a href="{% url 'admin:links_manager_link_add' %}" class="btn btn-success btn-lg text-white btn-block mt-4 mb-3">
    <i class="fa fa-circle-plus"></i> Create Link
  </a>

  <ul class="nav nav-pills nav-sidebar flex-column text-lg nav-fixed" role="menu">

    <li class="nav-item">
      <a href="{% url 'admin:index' %}" class="nav-link {% if HOME_PATH == request.path|urlencode %}active{% endif %}">
        <i class="fas fa-tachometer-alt nav-icon"></i>
        <p>Dashboard</p>
      </a>
    </li>

    {% for app in app_list %}
      <li class="nav-header">{{ app.name|upper }}</li>

      {% for model in app.models %}

        {% if model.admin_url %}
          <li class="nav-item">
            <a href="{{ model.admin_url }}" class="nav-link {% if model.admin_url in request.path|urlencode %}active{% endif %}">
              {{ model.model.icon|safe }}
              <p>{{ model.name }}</p>
            </a>
          </li>
        {% endif %}

      {% endfor %}

    {% endfor %}

    {% if user.is_superuser %}
      <li class="nav-header">{{ 'Settings & Configs'|upper }}</li>

      <li class="nav-item">
        <a href="{% url 'admin:settings' %}" class="nav-link {% if 'settings' == request.path|urlencode %}active{% endif %}">
          <i class="fas fa-gear nav-icon"></i>
          <p>Settings</p>
        </a>
      </li>
    {% endif %}

  </ul>

</nav>
<!-- /.sidebar-menu -->
